

let includes = ([
    "include/common.js",
    "include/gameConf.js",
]);


let inherits = ([
    "inherit/damage.js",
]);


//父类属性 子类可以继承和重新赋值
let _fastKiller = {name:"test!!1"};

function heartbeat() {
    os.debug("我是char的心跳");
    return {};
}

//自身的攻击+技能附带的攻击
function currentAttack() {
    let me      = thisObject();
    let attack  = me.get("attack");
    let n       = attack.applySkill + attack.attack;
    return n ;
}

/**
 * 动态随机装备技能
 * 回合战斗下使用
 * 返回整个技能信息
 */
function rdDynamicSkill() {
    let me  = thisObject();
    let skId = getRandomOneOfArr( me.get("rdSkills"));

    let sk = SKILL_CONF.filter((k, v,ary) => {
            if( k.id == skId ){
              return k;
            }
    });
    return  sk[0] ;
}

function initSkills() {
    // let me          = thisObject();
    // let meSkIds     = me.get("rdSkills");
    //
    // SKILL_CONF.forEach((k, v,ary) => {
    //     for (let skid in meSkIds) {
    //         if( k.id == meSkIds[skid] ){
    //             let attackVal = me.get("attack").attack;
    //             me.get("attack").applySkill += attackVal + attackVal * k.effVal;
    //         }
    //     }
    // });
}


/**
 * 获取临时增加的攻击属性
 * @param type
 * @returns {*}
 */
function getTempAttack( type ){
    return me.getTemp("attack")[type];
}

function getAttack(){

    let me = thisObject();
    let sk = me.rdDynamicSkill();
    //挂载技能提升buf  x * 20 / 100  境界 * 技能加成 / 100
    os.debug("->>>>>>>>>>>>>>","属性");
    os.debug((sk.effVal * 10),"加成");
    os.debug(me.get("jingjie"),"境界");
    let attack = me.get("jingjie") * 10 * (sk.effVal*10) / 100;
    //attack += me.getTempAttack("applyRdSkill");
    return attack;
}

function getDefense() {
    let me = thisObject();
    return me.get("defense");
}




